Hệ thống quản lý hàng tồn kho trong php

1 <?php
2   session_start();
3
4   
if (!isset($_SESSION['username'])) {
5     $_SESSION[
'msg'] = "You must log in first";
6     header(
'location: login.php');
7   }
8   
if (isset($_GET['logout'])) {
9     session_destroy();
10     unset($_SESSION[
'username']);
11     header(
"location: login.php");
12   }
13 ?>
14
15
16
17 <!doctype html>
18 <html
class="no-js" lang="en">
19
20 <head>
21     <meta charset=
"utf-8">
22     <meta http-equiv=
"x-ua-compatible" content="ie=edge">
23     <title>Inventory Management System</title>
24     <meta name=
"viewport" content="width=device-width, initial-scale=1">
25     <link rel=
"shortcut icon" type="image/png" href="assets/images/icon/favicon.ico">
26     <link rel=
"stylesheet" href="assets/css/bootstrap.min.css">
27     <link rel=
"stylesheet" href="assets/css/font-awesome.min.css">
28     <link rel=
"stylesheet" href="assets/css/themify-icons.css">
29     <link rel=
"stylesheet" href="assets/css/metisMenu.css">
30     <link rel=
"stylesheet" href="assets/css/owl.carousel.min.css">
31     <link rel=
"stylesheet" href="assets/css/slicknav.min.css">
32     <!-- amchart css -->
33     <link rel=
"stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
34     <!-- others css -->
35     <link rel=
"stylesheet" href="assets/css/typography.css">
36     <link rel=
"stylesheet" href="assets/css/default-css.css">
37     <link rel=
"stylesheet" href="assets/css/styles.css">
38     <link rel=
"stylesheet" href="assets/css/responsive.css">
39     <!-- modernizr css -->
40     <script src=
"assets/js/vendor/modernizr-2.8.3.min.js"></script>
41 </head>
42
43 <body>
44     <!--[
if lt IE 8]>
45             <p
class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
46         <![endif]-->
47     <!-- preloader area start -->
48     <div id=
"preloader">
49         <div
class="loader"></div>
50     </div>
51     <!-- preloader area end -->
52     
53     <!-- page container area start -->
54     <div
class="page-container">
55         <!-- sidebar menu area start -->
56         <div
class="sidebar-menu">
57             <div
class="sidebar-header">
58                 <div
class="logo">
59                     <a href=
"index.php"><img src="assets/images/icon/logo.png" alt="logo"></a>
60                 </div>
61             </div>
62             <div
class="main-menu">
63                 <div
class="menu-inner">
64                     <nav>
65                         <ul
class="metismenu" id="menu">
66                             <li>
67                                 <a href=
"index.php" aria-expanded="true"><i class="ti-dashboard"></i><span>dashboard</span></a>
68                                 
69                             </li>
70                             
71                            
72                             
73                             <li
class="active">
74                                 <a href=
"table.php" aria-expanded="true"><i class="fa fa-table"></i>
75                                     <span>Item Records</span></a>
76                                
77                             </li>
78                             
79                            
80                         </ul>
81                     </nav>
82                 </div>
83             </div>
84         </div>
85         <!-- sidebar menu area end -->
86
87
88         
89         <!-- main content area start -->
90         <div
class="main-content">
91             <!-- header area start -->
92             <div
class="header-area">
93                 <div
class="row align-items-center">
94                     <!-- nav and search button -->
95                     <div
class="col-md-6 col-sm-8 clearfix">
96                         <div
class="nav-btn pull-left">
97                             <span></span>
98                             <span></span>
99                             <span></span>
100                         </div>
101                         <div
class="search-box pull-left">
102                             <form action=
"#">
103                                 <input type=
"text" name="search" placeholder="Search..." required>
104                                 <i
class="ti-search"></i>
105                             </form>
106                         </div>
107                     </div>
108                     
109                     <!-- profile info & task notification-->
110                     <div
class="col-md-6 col-sm-4 clearfix">
111                         
112                     </div>
113                 </div>
114             </div>
115             
116             <!-- header area end -->
117             <!-- page title area start -->
118             <div
class="page-title-area">
119                 <div
class="row align-items-center">
120                     <div
class="col-sm-6">
121                         <div
class="breadcrumbs-area clearfix">
122                             <h4
class="page-title pull-left">Dashboard</h4>
123                             <ul
class="breadcrumbs pull-left">
124                                 <li><a href=
"index.php">Home</a></li>
125                                 <li><span>Item Records</span></li>
126                             </ul>
127                         </div>
128                     </div>
129                     <div
class="col-sm-6 clearfix">
130                         <div
class="user-profile pull-right">
131                             <img
class="avatar user-thumb" src="assets/images/author/avatar.png" alt="avatar">
132                             <h4
class="user-name dropdown-toggle" data-toggle="dropdown"><?php echo $_SESSION['username']; ?> <i class="fa fa-angle-down"></i></h4>
133                             <div
class="dropdown-menu">
134                                 
135                                <a
class="dropdown-item" href="index.php?logout='1'">Log Out</a>
136                             </div>
137                         </div>
138                     </div>
139                 </div>
140             </div>
141             <!-- page title area end -->
142             <div>
143             
144      <h1 style=
"text-align:center">Add Item Here</h1>
145             <body>
146 <form method=
"POST" class="form-inline" action="additem.php">
147   <div
class="form-group">
148     <label
for="name">Product Name</label>
149     <input type=
"text" class="form-control" name="product_name">
150     
151   </div>
152   <div
class="form-group">
153     <label
for="name">Price</label>
154     <input type=
"text" class="form-control" name="price">
155   </div>
156   <div
class="form-group">
157         <label
for="name">Quantity</label>
158         <input type=
"number" name="quant" id="quant" min="1" max="">
159     </div>
160   <button type=
"submit" class="btn btn-default" name="add">Add item</button>
161  
162 </form>
163 </body>
164             <div
class="main-content-inner">
165                 <div
class="row">
166                    
167                     <!-- Contextual Classes start -->
168                     <div
class="col-lg-6 mt-5">
169                         <div
class="card">
170                             <div
class="card-body">
171                                 <h4
class="header-title">Products</h4>
172                                 <div
class="single-table">
173                                     <div
class="table-responsive">
174                                         <table
class="table text-dark text-center">
175                                             <thead
class="text-uppercase">
176                                                 <tr
class="table-active">
177                                                     <th scope=
"col">ID</th>
178                                                     <th scope=
"col">Name</th>
179                                                     <th scope=
"col">Price</th>
180                                                     <th scope=
"col">Quantity</th>
181                                                      <th scope=
"col">Action</th>
182                                                      
183
184                                                     
185                                                 </tr>
186                                             </thead>
187                                             <tbody>
188             <?php
189                $conn =
new mysqli("localhost","root","","inventory");
190                $sql =
"SELECT * FROM product";
191                $result = $conn->query($sql);
192                     $count=
0;
193                
if ($result -> num_rows > 0) {
194                   
195                  
while ($row = $result->fetch_assoc())
196                  {
197                       $count=$count+
1;
198                    ?>
199                   
200                    
201                    <tr>
202                     <th><?php echo $count ?></th>
203                       <th><?php echo $row[
"product_name"] ?></th>
204                       <th><?php echo $row[
"price"] ?></th>
205                       <th><?php echo $row[
"quantity"] ?></th>
206                       
207                       <th> <a href=
"up"Edit></a><a href="edit.php?id=<?php echo $row["product_id"] ?>">Edit</a> <a href="up"Edit></a><a href="delete.php?id=<?php echo $row["product_id"] ?>">Delete</a></th>
208                     
209                       
210                     </tr>
211             <?php
212                  
213                  }
214                }
215
216             ?>
217
218                                             </tbody>
219                                         </table>
220            
221                                     </div>
222                                 </div>
223                             </div>
224                         </div>
225                         <div>
226
227
228 </div>
229                     </div>
230                     <!-- Contextual Classes end -->
231                    
232         <!-- main content area end -->
233       
234 <html>
235 <head>
236     <title>Add Item</title>
237     <link rel=
"stylesheet" type="text/css" href="style.css">
238     <link rel=
"stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
239 </head>
240
241 </html>
242     
243
244
245
246
247
248
249     </div>
250     <!-- page container area end -->
251     <!-- offset area start -->
252    
253     <!-- offset area end -->
254     <!-- jquery latest version -->
255     <script src=
"assets/js/vendor/jquery-2.2.4.min.js"></script>
256     <!-- bootstrap
4 js -->
257     <script src=
"assets/js/popper.min.js"></script>
258     <script src=
"assets/js/bootstrap.min.js"></script>
259     <script src=
"assets/js/owl.carousel.min.js"></script>
260     <script src=
"assets/js/metisMenu.min.js"></script>
261     <script src=
"assets/js/jquery.slimscroll.min.js"></script>
262     <script src=
"assets/js/jquery.slicknav.min.js"></script>
263
264     <!-- others plugins -->
265     <script src=
"assets/js/plugins.js"></script>
266     <script src=
"assets/js/scripts.js"></script>
267 </body>
268
269 </html>


Gõ tìm kiếm nhanh...